package org.graduation.recruitment.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.graduation.recruitment.entity.enums.EducationLevel;
import org.graduation.recruitment.entity.enums.JobType;
import org.graduation.recruitment.utils.ResponseResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 公共数据接口
 * 提供应用程序中常用的枚举数据，如工作类型和教育程度。
 */
@RestController
@RequestMapping("/common")
@Slf4j
@Tag(name = "公共数据", description = "提供公共枚举数据")
@SecurityRequirement(name = "openApiSecurityScheme")
public class CommonDataController {

    /**
     * 获取所有的工作类型枚举数据
     * 无参数
     *
     * @return 返回工作类型枚举的Map数据，键为枚举值的字符串表示，值为枚举名称
     */
    @GetMapping("/job_type")
    @Operation(summary = "工作类型接口", description = "比如全职、兼职、实习。")
    public ResponseResult getJobType() {
        return ResponseResult.success(JobType.toMap());
    }

    /**
     * 获取所有的学历枚举数据
     * 无参数
     *
     * @return 返回学历枚举的Map数据，键为枚举值的字符串表示，值为枚举名称
     */
    @GetMapping("/education_level")
    @Operation(summary = "学历枚举接口")
    public ResponseResult getEducationLevel() {
        return ResponseResult.success(EducationLevel.toMap());
    }
}
